Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

union-value

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

union-value

Set an array of unique values as the property of an object. Supports setting deeply nested properties using using object-paths/dot notation.

  • 1.0.1
  • patch
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.2M
decreased by-32.05%
Maintainers
2
Weekly downloads
 
Created

What is union-value?

The union-value npm package is used to add unique values to an array located at a specific property path within an object. It ensures that the values are not duplicated within the array.

What are union-value's main functionalities?

Add unique values to an array at a specific property path

This feature allows you to add a unique value to an array located at a specific property path within an object. In this example, the value 4 is added to the array at the path 'a.b.c'.

const union = require('union-value');
let obj = { a: { b: { c: [1, 2, 3] } } };
union(obj, 'a.b.c', 4);
console.log(obj); // { a: { b: { c: [1, 2, 3, 4] } } }

Add multiple unique values to an array at a specific property path

This feature allows you to add multiple unique values to an array located at a specific property path within an object. In this example, the values 4, 5, and 6 are added to the array at the path 'a.b.c'.

const union = require('union-value');
let obj = { a: { b: { c: [1, 2, 3] } } };
union(obj, 'a.b.c', [4, 5, 6]);
console.log(obj); // { a: { b: { c: [1, 2, 3, 4, 5, 6] } } }

Other packages similar to union-value

Keywords

FAQs

Package last updated on 24 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc